package com.zs.usc.controller;


import com.zs.usc.common.RestRst;
import com.zs.usc.constant.PermsConstraint;
import com.zs.usc.entity.RoleInfo;
import com.zs.usc.security.Authorization;
import com.zs.usc.service.IRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户角色表 前端控制器
 * </p>
 *
 * @author ZS
 * @since 2021-12-11
 */
@RestController
@RequestMapping("/role")
@Api(value = "角色模块", tags = "角色模块")
public class RoleController {

    @Autowired
    private IRoleService roleService;


    @PostMapping("/saveRole")
    @ApiOperation("新增角色信息")
    @Authorization(value = PermsConstraint.SEC_SYSTEM_ROLE_ADD)
    public RestRst<Integer> saveRole(@RequestBody RoleInfo role) {

        return RestRst.buildSuccess(this.roleService.save(role));
    }


}

